<? 
$accesslevel=1;
$title="Edit Profiles";

require("required/dbconnect.php"); 
require("required/function.php");
require("required/header.php"); 
?>
<script src="required/js/jquery-1.4.2.js"></script>
<script src="required/js/common_javascript.js"></script>
<?	
		
	if(!empty($_GET['action']))
	{
		switch($_GET['action'])
		{
			case 1:
				$msg="<div class='dw_failed'>Email already exist</div>";
				break;
			case 2:
				$msg="<div class='dw_success'>Data Deleted</div>";
				break;
			case 3:
				$msg="<div class='dw_success'>Data Updated</div>";
				break;	
			default:
				$msg="";
				break;
		}
		echo "<script>displayMsg('divMsg')</script>";	
	}else{
		$msg="";
	}
	
$id=$_GET['id'];
$getdata=mysql_query("select * from os_email_subscriber where id=".$id);

$a=mysql_fetch_array($getdata,MYSQL_ASSOC);
if($a['status']==0)
{
	$slt0="selected";
	$slt1="";
	
}
else
{
	$slt0="";
	$slt1="selected";
}
?>
<script language="JavaScript" type="text/javascript" src="required/js/goAjax.js"></script>	
<script type="text/javascript" src="../required/calendarDateInput.js">
</script>

<script language="javascript">
	function checkMemberCardExist(field,divName,showName) {
		
		var value = document.getElementById(field).value;
		
		var escapeValue = document.getElementById("member_card_number_current").value;
		
		if(value!=""){
			changeContent('required/js/CheckMemberExist.php?escapeValue='+escapeValue+'&field='+field+'&value='+value+'&showName='+showName,divName);
		}
	}

	function formvalidate(frm)
	{
	
		if(document.frm.sub_first_name.value=="")
		{
			alert("Please enter first name");
			document.frm.sub_first_name.focus();
			return false;
		}
		
		if(document.frm.sub_last_name.value=="")
		{
			alert("Please enter last name");
			document.frm.sub_last_name.focus();
			return false;
		}
		
		return true;
	}
</script>


		
<table width="100%">
	<tr>
		<td  valign="top">
			<table width="100%" height="100%" >
				<tr >
					<td colspan="5" class="title">Edit Subsciber</td>
				</tr>
                
				<form action="subscriber_edit2.php" method="post" name="frm" onSubmit="return formvalidate(this)">
					<tr>
						<td colspan="5"><div id="divMsg"><?= $msg ?></div></td>
                    </tr>
                 	<tr>
						<td>First Name<font color="#FF0000">*</font></td><td>:</td><td><input type="text" class='text' size="30" maxlength="50" name="sub_first_name" value="<?= $a['sub_first_name'] ?>" ></td>
					</tr>
                    <tr>
						<td>Last Name<font color="#FF0000">*</font></td><td>:</td><td><input type="text" class='text' size="30" maxlength="50" name="sub_last_name" value="<?= $a['sub_last_name'] ?>" ></td>
					</tr>
            		<tr>
						<td>Email<font color="#FF0000">*</font></td><td>:</td><td><input type="text" class='text' size="30" maxlength="50" name="sub_email" value="<?= $a['sub_email'] ?>"></td>
					</tr>
                    <tr>
						<td>Status<font color="#FF0000">*</font></td><td>:</td><td>
                        	<select name="status" class="text">
									<option value="0" <?= $slt0 ?>>No</option>
									<option value="1" <?= $slt1 ?>>Yes</option>
								</select>
                        </td>
					</tr>
				
					<input type="hidden" value="<?= $a['sub_email'] ?>" name="current_email">
					<input type="hidden" value="<?= $id ?>" name="id">
					<tr>
						<td colspan="3" align="center"><input type="submit" value="Submit" class="button"> <input type="button" onClick="window.open('subscriber_view_all.php','_self')" value="Back" class="button">
						</td>
					</tr>	
					</form>
				</table>
			</td>
		</tr>
	</table>
			
<? require("required/footer.php"); ?>